package com.cmc.controller;

import com.cmc.bo.UserBO;
import com.cmc.req.UserReq;
import com.cmc.service.UserService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.lang.NonNull;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author chengmingchao
 */
@RestController
@RequestMapping("user")
public class UserController {
    @Autowired
    private UserService userService;

    @PostMapping("/saveUser")
    public String saveUser(@RequestBody @NonNull UserReq userReq) {
        UserBO userBO=new UserBO();
        BeanUtils.copyProperties(userReq,userBO);
        userService.saveUser(userBO);
        return "保存成功";
    }

}
